#include <map>
#include <fstream>
#include <iostream>
#include <iomanip>
const int C = 100;
const int K = 10;
using namespace std;

int num_not_gen_flow;
int num_gen_flow;
int num_service;
double link_capacity;
double rate_hot;

double rate_hot_dct;

double generater(){
	int random = rand()%100;
	double R = rand()%200;
	R /= 100;
	if (random < rate_hot_dct * 100)
	{
		return link_capacity/num_gen_flow/C * R * K;
	}
	else{
		return link_capacity/num_gen_flow/C;
	}
}

int main(int argc, char *argv[]){

	if (argc != 3)
	{
		cout << "FLG <Info.txt> <ServiceFlow.txt>" <<endl;
	}

	ifstream infile(argv[1]);
	ofstream outfile(argv[2]);

	infile>>num_not_gen_flow;
	infile>>num_gen_flow;
	infile>>num_service;
	infile>>link_capacity;
	infile>>rate_hot;


	rate_hot_dct = (num_gen_flow - 1.0)  / 2 * rate_hot;


	outfile<<num_service<<endl;
	for (int i = 0; i < num_service; i++)
	{
		
		for (int j = 0; j < num_gen_flow; ++j)
		{
			outfile << i <<" ";
			outfile << j + num_not_gen_flow<<" ";
			double flow = generater();
			outfile <<setprecision(2)<<flow<<endl;
		}
	}

}